home *** CD-ROM | disk | FTP | other *** search
- Path: dinews.epfl.ch!usenet
- From: Bernhard Ruch <Bernhard.Ruch@studi.epfl.ch>
- Newsgroups: comp.lang.c++
- Subject: Linker error: (Class method name) "multipy defined"
- Date: Thu, 18 Apr 1996 19:32:28 +0200
- Organization: Ecole Polytechnique Federale de Lausanne
- Message-ID: <31767CAC.167E@studi.epfl.ch>
- NNTP-Posting-Host: didec11.epfl.ch
- Mime-Version: 1.0
- Content-Type: text/plain; charset=us-ascii
- Content-Transfer-Encoding: 7bit
- X-Mailer: Mozilla 3.0b2 (X11; I; OSF1 V3.2 alpha)
- CC: Bernhard.Ruch@studi.epfl.ch
-
- When I try to compile my program, I get the following linker error:
-
- g++ -g -Wall -o ListTest ListTest.o DoubList.o POB_ObjectStream.o
- collect2: ld returned 1 exit status
- /usr/bin/ld:
- DoubList.o: operator>>(POB_ObjectInStream &, DoubleLink *&): multiply defined
- DoubList.o: operator>>(POB_ObjectInStream &, DoubleLinkedList *&): multiply defined
- Warning: Linking some objects which contain exception information sections
- and some which do not. This may cause fatal runtime exception handling
- problems (last obj encountered without exceptions was /usr/local/lib/libstdc++.a).
- Warning: clog defined as GLOBAL DATA but is defined in a shared lib as a GLOBAL FUNC
- *** Exit 1
- Stop.
-
-
- I tried to find the problem for a long time, but I could not find it. I looked for
- the definition of the operator >>, but I found only one definition for each of the
- two classes (DoubleLink, DoubleLinkedList).
-
- There is one thing where I'm not sure if it's correct what I do:
-
- I have four classes: POB_Object, POB_ObjectInStream, DoubleLink and DoubleLinkedList
-
- The two classes DoubleLink and DoubleLinkedList are derived from POB_Object.
-
-
- In the class POB_ObjectInStream, I overload the operator >> several times:
-
- POB_ObjectInStream& POB_ObjectInStream :: operator >> (POB_Object &pObject);
- POB_ObjectInStream& POB_ObjectInStream :: operator >> (POB_Object **ppObject);
-
-
- Then, I define two Pointer-types:
-
- typedef DoubleLink* DoubleLinkPointer
- typedef DoubleLinkedList* DoubleLinkedListPointer
-
- and overload the operator >> again twice:
-
- POB_ObjectInStream& operator >> (POB_ObjectInStream &pInputStream, DoubleLinkPointer &pDoubleLink)
- POB_ObjectInStream& operator >> (POB_ObjectInStream &pInputStream, DoubleLinkListPointer &pDoubleLinkList)
-
-
- Now, could it be that the linker doesn't like the two versions of operator>> for
- DoubleLinkPointer& (which is actually also a pointer to POB_Object, since DoubleLink
- is derived from POB_Object) and for POB_Object** ?
-
- But I suppose that, should this be the case, the compiler should already return an
- error message.
-
-
- Does anybody know exactly, what the linker error "multiply defined" means, or where I could get
- some documentation about it?
-
-
- Thanks
-
- Bernhard
-